package com.sun.weekend.base;

import android.content.Context;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.sun.weekend.beans.UserBean;

import cn.bmob.v3.BmobUser;

public abstract class BaseFragment extends Fragment {

    protected Context mContext;
    protected LayoutInflater mInflater;
    protected UserBean userBean;
    public BaseFragment() {
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mContext = getContext();
        mInflater = LayoutInflater.from(mContext);

    }

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View contentView = inflater.inflate(getLayoutId(),container,false);
        findViews(contentView);
        return contentView;
    }

    @Override
    public void onStart() {
        super.onStart();
        userBean = BmobUser.getCurrentUser(UserBean.class);
    }

    @Override
    public void onDetach() {
        super.onDetach();
    }

    protected abstract int getLayoutId();

    protected abstract void findViews(View view);
}
